package com.ruoyi.web.controller.system;

import java.util.List;

import com.ruoyi.common.core.domain.entity.SignLogTime;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.ISignLogTimeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 签章次数 Controller
 * 
 * @author ess
 * @date 2021-10-18
 */
@RestController
@RequestMapping("/system/signLogTime")
public class SignLogTimeController extends BaseController
{
    @Autowired
    private ISignLogTimeService signLogTimeService;

    /**
     * 查询签章次数 列表
     */
    @PreAuthorize("@ss.hasPermi('system:signLogTime:list')")
    @GetMapping("/list")
    public TableDataInfo list(SignLogTime signLogTime)
    {
        startPage();
        List<SignLogTime> list = signLogTimeService.selectSignLogTimeList(signLogTime);
        return getDataTable(list);
    }

    /**
     * 导出签章次数 列表
     */
    @PreAuthorize("@ss.hasPermi('system:signLogTime:export')")
    @Log(title = "签章次数 ", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SignLogTime signLogTime)
    {
        List<SignLogTime> list = signLogTimeService.selectSignLogTimeList(signLogTime);
        ExcelUtil<SignLogTime> util = new ExcelUtil<SignLogTime>(SignLogTime.class);
        return util.exportExcel(list, "签章次数 数据");
    }

    /**
     * 获取签章次数 详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:signLogTime:query')")
    @GetMapping(value = "/{signLogTimeId}")
    public AjaxResult getInfo(@PathVariable("signLogTimeId") String signLogTimeId)
    {
        return AjaxResult.success(signLogTimeService.selectSignLogTimeBySignLogTimeId(signLogTimeId));
    }

    /**
     * 新增签章次数 
     */
    @PreAuthorize("@ss.hasPermi('system:signLogTime:add')")
    @Log(title = "签章次数 ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SignLogTime signLogTime)
    {
        return toAjax(signLogTimeService.insertSignLogTime(signLogTime));
    }

    /**
     * 修改签章次数 
     */
    @PreAuthorize("@ss.hasPermi('system:signLogTime:edit')")
    @Log(title = "签章次数 ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SignLogTime signLogTime)
    {
        return toAjax(signLogTimeService.updateSignLogTime(signLogTime));
    }

    /**
     * 删除签章次数 
     */
    @PreAuthorize("@ss.hasPermi('system:signLogTime:remove')")
    @Log(title = "签章次数 ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{signLogTimeIds}")
    public AjaxResult remove(@PathVariable String[] signLogTimeIds)
    {
        return toAjax(signLogTimeService.deleteSignLogTimeBySignLogTimeIds(signLogTimeIds));
    }
}
